package com.emmmya.ocs.modules.system.serviceImpl;

import com.emmmya.ocs.common.base.BaseDao;
import com.emmmya.ocs.modules.system.dao.MenuDao;
import com.emmmya.ocs.modules.system.dao.mapper.MenuMapper;
import com.emmmya.ocs.modules.system.entity.Menu;
import com.emmmya.ocs.modules.system.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @author: 咕噜肉IT小店-黑医
 * @createDate: 2020-11-16
 * @version: 1.0
 */
@Service
public class MenuServiceImpl implements MenuService {
    @Autowired
    MenuDao menuDao;

    @Autowired
    MenuMapper menuMapper;

    @Override
    public BaseDao<Menu, Long> getRepository() {
        return menuDao;
    }

    @Override
    public List<Menu> findByLevel(Integer level) {
        return menuDao.findByLevelOrderBySortNoAsc(level);
    }

    @Override
    public List<Menu> findByParentId(Integer parentId) {
        return menuMapper.selectByParentId(parentId);
    }

    @Override
    public Integer updateByPrimaryKeySelective(Menu menu) {
        return menuMapper.updateByPrimaryKeySelective(menu);
    }
}
